#include "qopenharmonycamerasession.h"
#include "qopenharmonycameracontrol.h"
#include "qopenharmonycaptureservice.h"
#include "qmediaserviceproviderplugin.h"
#include "qopenharmonycamerainfocontrol.h"

QOPenHarmonyCaptureService::QOPenHarmonyCaptureService(const QString &service, QObject *parent)
    : QMediaService{ parent }
    , m_service(service)
{
    if (m_service == QLatin1String(Q_MEDIASERVICE_CAMERA)) {
        m_cameraSession = new QOPenHarmonyCameraSession();
        m_cameraControl = new QOPenHarmonyCameraControl(m_cameraSession);
        m_cameraInfoControl = new QOPenHarmonyCameraInfoControl();
    } else {
        m_cameraSession = Q_NULLPTR;
        m_cameraControl = Q_NULLPTR;
        m_cameraInfoControl = Q_NULLPTR;
    }
}

QOPenHarmonyCaptureService::~QOPenHarmonyCaptureService()
{
    delete m_cameraInfoControl;
    delete m_cameraControl;
    delete m_cameraSession;
}

QMediaControl *QOPenHarmonyCaptureService::requestControl(const char *name)
{
    if (qstrcmp(name, QCameraInfoControl_iid) == 0)
        return m_cameraInfoControl;
}

void QOPenHarmonyCaptureService::releaseControl(QMediaControl *)
{

}
